package com.haochu.xxl.animate;

import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;

import com.haochu.xxl.model.PointItem;

/**
 * @author Administrator 元素消失动画类
 */
public class RemoveAnimation extends Animation {
	// 游戏界面view
	private View view;
	// 元素点
	private PointItem point;

	public RemoveAnimation(View view, PointItem point) {
		this.view = view;
		this.point = point;
		this.point.setType(1);
		this.point.setIndex(0);
		this.setDuration(300);
	}

	@Override
	protected void applyTransformation(float interpolatedTime, Transformation t) {
		super.applyTransformation(interpolatedTime, t);
		if (interpolatedTime < 1.0f) {
			point.setIndex((int)(interpolatedTime*4));
		} else {
			point.setIndex(3);
			point.setType(0);
		}
		view.postInvalidate();
	}
}